home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kdcopservicestarter.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  4.2 KB  |  104 lines

  1. /* This file is part of the KDE libraries
  2.    Copyright (C) 2003 David Faure <faure@kde.org>
  3.  
  4.    This library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public
  6.    License version 2 as published by the Free Software Foundation.
  7.  
  8.    This library is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.    Library General Public License for more details.
  12.  
  13.    You should have received a copy of the GNU Library General Public License
  14.    along with this library; see the file COPYING.LIB.  If not, write to
  15.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16.    Boston, MA 02110-1301, USA.
  17. */
  18.  
  19. #ifndef KDCOPSERVICESTARTER_H
  20. #define KDCOPSERVICESTARTER_H
  21.  
  22. #include <qstring.h>
  23. #include <kstaticdeleter.h>
  24.  
  25. class KDCOPServiceStarter;
  26. class QCString;
  27.  
  28. /**
  29.  * A generic DCOP service starter, using KTrader.
  30.  * The default implementation starts new processes, but this interface can
  31.  * also be reimplemented by specific applications to provide dlopened in-process DCOP objects.
  32.  * @author David Faure <faure@kde.org>
  33.  */
  34. class KIO_EXPORT KDCOPServiceStarter {
  35.     friend class KStaticDeleter<KDCOPServiceStarter>;
  36. public:
  37.  
  38.     static KDCOPServiceStarter* self();
  39.  
  40.     /**
  41.      * Check if a given DCOP interface is available - from the serviceType it's supposed to implement.
  42.      *
  43.      * The trader is queried to find the preferred application for this serviceType,
  44.      * with the constraint that its X-DCOP-ServiceName property must be defined.
  45.      * Then the DCOP server is checked. If the service is not available,
  46.      * this method will call startServiceFor to start it.
  47.      *
  48.      * @param serviceType the type of service we're looking for
  49.      * @param constraint see KTrader
  50.      * @param preferences see KTrader
  51.      * @param error On failure, @p error contains a description of the error
  52.      *         that occurred. If the pointer is 0, the argument will be
  53.      *         ignored
  54.      * @param dcopService On success, @p dcopService contains the DCOP name
  55.      *         under which this service is available. If the pointer is 0 the argument
  56.      *         will be ignored
  57.      * @param flags for future extensions (currently unused)
  58.      *
  59.      * @return an error code indicating success (== 0) or failure (> 0).
  60.      */
  61.     int findServiceFor( const QString& serviceType,
  62.                         const QString& constraint = QString::null,
  63.                         const QString& preferences = QString::null,
  64.                         QString *error=0, QCString* dcopService=0,
  65.                         int flags=0 );
  66.  
  67.     /**
  68.      * Find an implementation of the given @p serviceType,
  69.      * and start it, to use its DCOP interface.
  70.      * The default implementation uses KTrader to find the preferred Application,
  71.      * and then starts it using kapp->startService...
  72.      *
  73.      * However applications (like kontact) can reimplement this method, to provide
  74.      * an in-process way of loading the implementation for this service type.
  75.      *
  76.      * @param serviceType the type of service we're looking for
  77.      * @param constraint see KTrader
  78.      * @param preferences see KTrader
  79.      * @param error On failure, @p error contains a description of the error
  80.      *         that occurred. If the pointer is 0, the argument will be
  81.      *         ignored
  82.      * @param dcopService On success, @p dcopService contains the DCOP name
  83.      *         under which this service is available. If the pointer is 0 the argument
  84.      *         will be ignored
  85.      * @param flags for future extensions (currently unused)
  86.      *
  87.      * @return an error code indicating success (== 0) or failure (> 0).
  88.      */
  89.     virtual int startServiceFor( const QString& serviceType,
  90.                                  const QString& constraint = QString::null,
  91.                                  const QString& preferences = QString::null,
  92.                                  QString *error=0, QCString* dcopService=0,
  93.                                  int flags=0 );
  94. protected:
  95.     KDCOPServiceStarter();
  96.     virtual ~KDCOPServiceStarter();
  97.  
  98. private:
  99.     static KDCOPServiceStarter* s_self;
  100. };
  101.  
  102. #endif
  103.  
  104.